package com.duowan.realtime.scheduled.batch;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @author tangsicheng
 * @version 1.0
 * @since 1.0
 */
public class BatchEntry {
    public static void main(String[] args) {
        Logger logger = LoggerFactory.getLogger(BatchEntry.class);
        logger.info("同步redis和mysql数据");
        String configLocation = "classpath*:/spring/*.xml";
        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(configLocation);
        MyJobLauncher bean = (MyJobLauncher) context.getBean("myJobLauncher");
        try {
            bean.startOnceAtInit();
        } catch (Exception e) {
            logger.error(e.getMessage(), "spring-batch启动失败！");
            System.exit(-1);
        }
    }
}
